package art_of_java_concurrent_programming.lock.read_write_lock;

/**
 * @author lixiangke
 * @date 2018/1/29
 */
public class CacheTest {
    public static void main(String[] args) {
        Thread t1 = new Thread() {
            @Override
            public void run() {
                Cache.get("hello");
            }
        };
        Thread t2 = new Thread() {
            @Override
            public void run() {
                Cache.get("world");
                Cache.get("world");
            }
        };
        Thread t3 = new Thread() {
            @Override
            public void run() {
                Cache.get("my");
            }
        };
        Thread t4 = new Thread() {
            @Override
            public void run() {
                Cache.put("name", "name");
            }
        };
        Thread t5 = new Thread() {
            @Override
            public void run() {
                Cache.get("name");
            }
        };

        t1.start();
        t2.start();
        t3.start();
        t4.start();
        t5.start();
    }
}
